import 'package:flutter/widgets.dart';

enum Position {
  Left,
  Middle,
  Right,
  Top,
  Bottom
}

class FlowCard extends StatelessWidget {

  final Widget child;
  final Position position;

  FlowCard({ @required this.child, this.position = Position.Middle });

  @override
  Widget build(BuildContext context) {
    return Container(
      margin: compactMargin(),
      child: child
    );
  }
  
  compactMargin() {
    final double marginHalf = 6;
    if (position == Position.Middle) {
      return EdgeInsets.all(marginHalf);
    }
    if (position == Position.Left) {
      return EdgeInsets.fromLTRB(marginHalf * 2, marginHalf, marginHalf, marginHalf);
    }
    if (position == Position.Right) {
      return EdgeInsets.fromLTRB(marginHalf, marginHalf, marginHalf * 2, marginHalf);
    }
    if (position == Position.Top) {
      return EdgeInsets.fromLTRB(marginHalf, marginHalf * 2, marginHalf, marginHalf);
    }
    if (position == Position.Bottom) {
      return EdgeInsets.fromLTRB(marginHalf, marginHalf, marginHalf, marginHalf * 2);
    }
  }
}